import os
import sys

# 调整路径设置，确保可以找到D5Core模块
sys.path.insert(0, os.path.abspath('../../D5Core'))  # 添加项目根目录

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'D5Core'
copyright = '2025, D5Render'
author = 'D5Render'
release = '0.1.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
    'sphinx.ext.autodoc',   # 自动从 docstring 生成文档
    'sphinx.ext.napoleon',  # 解析 Google 和 NumPy 风格的 docstring
    'sphinx.ext.autosummary',  # 自动生成摘要表格
]

# 告诉autodoc忽略导入这些模块时的错误
autodoc_mock_imports = ['D5', 'PySide2', 'shiboken2']  # 添加所有需要忽略的模块

# 自动生成API文档的设置
autodoc_default_options = {
    'members': True,
    'member-order': 'bysource',
    'special-members': '__init__',
    'undoc-members': True,
    'exclude-members': '__weakref__'
}

# 为了在目录中显示正确的名称，设置下面的选项
html_title = 'D5Core Documentation'

templates_path = ['_templates']
exclude_patterns = []

language = 'zh_CN'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'  # 使用Read the Docs主题，更适合API文档
html_static_path = ['_static']

# 添加自定义样式
html_css_files = [
    'css/custom.css',
]

# 链接到Python文档
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}


